import {RouteRecordRaw,createRouter,createWebHistory} from 'vue-router'

//路由配置集合
const routes:Array<RouteRecordRaw>=[
    {
        path:'/product',
        component:()=>import('@/views/Product.vue'),
        children:[
            {
                path:'hotProduct',
                component:()=>import('@/views/HotProduct.vue')
            },
            {
                path:'newsProduct',
                component:()=>import('@/views/NewsProduct.vue')
            },
            {
                path:'hotProductDetail/:id',
                component:()=>import('@/views/HotProductDetail.vue')
            },
            {
                path:'newsProductDetail',
                component:()=>import('@/views/NewsProductDetail.vue')
            }
        ]
    },
    {
        path:'/category',
        component:()=>import('@/views/Category.vue')
    },
    {
        path:'/order',
        component:()=>import('@/views/Order.vue')
    }
]

/*
    通过vue-router中的createRouter函数来创建路由器对象
    这个方法的参数式路由配置对象
    常见的属性如下
    routes:路由配置集合

*/
const router=createRouter({
    routes,
    history:createWebHistory()
})
export default router